#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e6+10;
const int mod = 1e9+7;

int mx,dp[N],f[32],p[N],n;
ll ans;

int popcnt(int x){int res=0;for(;x;x>>=1)res+=x&1;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1,x;i <= n;i++) dp[x=in]++,mx = max(mx,x); for(int i = (p[0]=1);i<N;i++) p[i] = (p[i-1]<<1) % mod;
	for(int i = 0;i < 20;i++)
		for(int j = 0;j <= mx;j++)
			if(j >> i & 1)
				(dp[j^1<<i] += dp[j]) %= mod;
	for(int i = 0;i <= mx;i++) (f[popcnt(i)] += p[dp[i]]-1) %= mod;
	for(int i = 0;i < 20;i++) ans = (ans + (i & 1 ? mod - f[i] : f[i])) % mod;
	printf("%lld\n",ans);	
	return 0;
}

